package com.base.cn.platform.os.controller.classes.topic.share;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.common.utils.DataUtil;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.service.classes.topic.share.ClassesTopicShareRecordBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 班级话题分享记录Controller
 *
 * @author zsw
 * @since 2018/7/30
 */
@RestController
@RequestMapping("/course")
public class ClassesTopicShareRecordController extends BaseController {

    @Autowired
    private ClassesTopicShareRecordBiz classesTopicShareRecordBiz;

    @RequestMapping("/saveClassesTopicShareRecord")
    public Map<String,Object> saveClassesTopicshareRecord (@RequestParam("topicId") BigDecimal topicId,
                                                           @RequestParam("userId") BigDecimal userId){
        if(DataUtil.idIsNotNull(topicId) && DataUtil.idIsNotNull(userId)){
            classesTopicShareRecordBiz.saveShareRecord(topicId,userId);
            return ResultUtil.SUCCESS("分享成功");
        }
        return ResultUtil.ERROR("参数错误");
    }
}
